home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / pushd.pro < prev    next >
Text File  |  1997-07-08  |  962b  |  44 lines

  1. ; $Id: pushd.pro,v 1.3 1997/01/15 03:11:50 ali Exp $
  2. ;
  3. ; Copyright (c) 1989-1997, Research Systems, Inc.  All rights reserved.
  4. ;       Unauthorized reproduction prohibited.
  5.  
  6. ;+
  7. ; NAME:
  8. ;    PUSHD
  9. ;
  10. ; PURPOSE:
  11. ;    Push a directory onto the top of the directory stack maintained
  12. ;    by the PUSHD and POPD User Library procedures.
  13. ;
  14. ; CALLING SEQUENCE:
  15. ;    PUSHD, Dir
  16. ;
  17. ; INPUTS:
  18. ;    Dir:    The directory to change to. The current directory will
  19. ;        be pushed to the top of the directory stack.
  20. ;
  21. ; SIDE EFFECTS:
  22. ;    The current directory is pushed onto the directory stack.
  23. ;    It will be the next directory used by POPD.
  24. ;
  25. ; COMMON BLOCKS:
  26. ;    DIR_STACK:  Contains the stack.
  27. ;
  28. ; MODIFICATION HISTORY:
  29. ;    17, July, 1989, Written by AB, RSI.
  30. ;-
  31. ;
  32. ;
  33. pro pushd,dir
  34.  
  35. COMMON DIR_STACK, DEPTH, STACK
  36. on_error, 2        ; Return to caller on error
  37.  
  38. if (n_elements(DEPTH) eq 0) then depth = 0
  39. CD, dir, CURRENT=cwd
  40.  
  41. if (DEPTH eq 0) then STACK = [CWD] else STACK = [CWD, STACK]
  42. DEPTH = DEPTH + 1
  43. end
  44.